// Lean compiler output
// Module: Init.Data.Format.Instances
// Imports: public import Init.Data.Array.Basic import Init.Data.String.Search
#include <lean/lean.h>
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wunused-label"
#elif defined(__GNUC__) && !defined(__CLANG__)
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
#ifdef __cplusplus
extern "C" {
#endif
LEAN_EXPORT lean_object* l_instToFormatArray___redArg(lean_object*);
lean_object* lean_string_utf8_extract(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_instToFormatProd___redArg(lean_object*, lean_object*);
lean_object* lean_mk_empty_array_with_capacity(lean_object*);
static lean_object* l_instToFormatProd___redArg___lam__0___closed__3;
lean_object* lean_string_utf8_next_fast(lean_object*, lean_object*);
static lean_object* l_Option_format___redArg___closed__0;
static lean_object* l_List_format___redArg___closed__10;
static lean_object* l_instToFormatProd___redArg___lam__0___closed__4;
static lean_object* l_List_format___redArg___closed__9;
static lean_object* l_instToFormatProd___redArg___lam__0___closed__5;
lean_object* lean_array_push(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_String_toFormat(lean_object*);
static lean_object* l_Option_format___redArg___closed__2;
static lean_object* l_List_format___redArg___closed__0;
LEAN_EXPORT lean_object* l_instToFormatList(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_format(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_instToFormatOfToString___redArg___lam__0(lean_object*);
lean_object* lean_string_length(lean_object*);
lean_object* lean_string_utf8_byte_size(lean_object*);
LEAN_EXPORT lean_object* l_Std_Format_joinSep___at___00String_toFormat_spec__2(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_instToFormatArray___redArg___lam__0(lean_object*, lean_object*);
lean_object* l_Function_comp(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint32_t lean_string_utf8_get_fast(lean_object*, lean_object*);
lean_object* l_Nat_reprFast(lean_object*);
lean_object* l_instNatCastInt___lam__0(lean_object*);
static lean_object* l_List_format___redArg___closed__1;
lean_object* l_Std_Format_joinSep___redArg(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_instToFormatList___redArg(lean_object*);
LEAN_EXPORT lean_object* l_instToFormatOfToString(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Std_Iterators_IterM_DefaultConsumers_toArrayMapped_go___at___00String_toFormat_spec__1___redArg(lean_object*, lean_object*, lean_object*);
lean_object* lean_array_to_list(lean_object*);
LEAN_EXPORT lean_object* l_Option_format(lean_object*, lean_object*, lean_object*);
static lean_object* l_instToFormatProd___redArg___lam__0___closed__2;
LEAN_EXPORT lean_object* l_List_format___redArg(lean_object*, lean_object*);
static lean_object* l_instToFormatArray___redArg___lam__0___closed__0;
lean_object* l_String_Slice_slice_x21(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_String_Slice_split___at___00String_toFormat_spec__0___boxed(lean_object*);
uint8_t lean_nat_dec_eq(lean_object*, lean_object*);
static lean_object* l_String_toFormat___closed__0;
uint8_t lean_uint32_dec_eq(uint32_t, uint32_t);
LEAN_EXPORT lean_object* l_Std_Iterators_IterM_DefaultConsumers_toArrayMapped_go___at___00String_toFormat_spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_foldl___at___00Std_Format_joinSep___at___00String_toFormat_spec__2_spec__2(lean_object*, lean_object*, lean_object*);
static lean_object* l_List_format___redArg___closed__7;
static lean_object* l_List_format___redArg___closed__8;
static lean_object* l_String_Slice_split___at___00String_toFormat_spec__0___closed__0;
lean_object* lean_nat_sub(lean_object*, lean_object*);
static lean_object* l_instToFormatArray___redArg___lam__0___closed__1;
static lean_object* l_List_format___redArg___closed__4;
LEAN_EXPORT lean_object* l_instToFormatOfToString___redArg(lean_object*);
static lean_object* l_List_format___redArg___closed__5;
static lean_object* l_Option_format___redArg___closed__1;
LEAN_EXPORT lean_object* l_instToFormatRaw___lam__0(lean_object*);
static lean_object* l_List_format___redArg___closed__3;
LEAN_EXPORT lean_object* l_instToFormatRaw;
static lean_object* l_instToFormatProd___redArg___lam__0___closed__1;
LEAN_EXPORT lean_object* l_instToFormatArray(lean_object*, lean_object*);
static lean_object* l_List_format___redArg___closed__2;
LEAN_EXPORT lean_object* l_Option_format___redArg(lean_object*, lean_object*);
lean_object* lean_nat_add(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_instToFormatProd___redArg___lam__0(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_String_Slice_split___at___00String_toFormat_spec__0(lean_object*);
LEAN_EXPORT lean_object* l_instToFormatOption(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_instToFormatOption___redArg(lean_object*);
static lean_object* l_Option_format___redArg___closed__3;
LEAN_EXPORT lean_object* l_instToFormatProd(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_instToFormatProd___redArg___lam__0___closed__0;
static lean_object* l_List_format___redArg___closed__6;
LEAN_EXPORT lean_object* l_instToFormatOfToString___redArg___lam__0(lean_object* x_1) {
_start:
{
lean_object* x_2; 
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_instToFormatOfToString___redArg(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; 
x_2 = lean_alloc_closure((void*)(l_instToFormatOfToString___redArg___lam__0), 1, 0);
x_3 = lean_alloc_closure((void*)(l_Function_comp), 6, 5);
lean_closure_set(x_3, 0, lean_box(0));
lean_closure_set(x_3, 1, lean_box(0));
lean_closure_set(x_3, 2, lean_box(0));
lean_closure_set(x_3, 3, x_2);
lean_closure_set(x_3, 4, x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_instToFormatOfToString(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_instToFormatOfToString___redArg(x_2);
return x_3;
}
}
static lean_object* _init_l_List_format___redArg___closed__0() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("[]", 2, 2);
return x_1;
}
}
static lean_object* _init_l_List_format___redArg___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_List_format___redArg___closed__0;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_List_format___redArg___closed__2() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked(",", 1, 1);
return x_1;
}
}
static lean_object* _init_l_List_format___redArg___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_List_format___redArg___closed__2;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_List_format___redArg___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; 
x_1 = lean_box(1);
x_2 = l_List_format___redArg___closed__3;
x_3 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_3, 0, x_2);
lean_ctor_set(x_3, 1, x_1);
return x_3;
}
}
static lean_object* _init_l_List_format___redArg___closed__5() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("[", 1, 1);
return x_1;
}
}
static lean_object* _init_l_List_format___redArg___closed__7() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_List_format___redArg___closed__5;
x_2 = lean_string_length(x_1);
return x_2;
}
}
static lean_object* _init_l_List_format___redArg___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_List_format___redArg___closed__7;
x_2 = l_instNatCastInt___lam__0(x_1);
return x_2;
}
}
static lean_object* _init_l_List_format___redArg___closed__9() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_List_format___redArg___closed__5;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_List_format___redArg___closed__6() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("]", 1, 1);
return x_1;
}
}
static lean_object* _init_l_List_format___redArg___closed__10() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_List_format___redArg___closed__6;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_List_format___redArg(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3; 
lean_dec_ref(x_1);
x_3 = l_List_format___redArg___closed__1;
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12; lean_object* x_13; 
x_4 = l_List_format___redArg___closed__4;
x_5 = l_Std_Format_joinSep___redArg(x_1, x_2, x_4);
x_6 = l_List_format___redArg___closed__8;
x_7 = l_List_format___redArg___closed__9;
x_8 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_5);
x_9 = l_List_format___redArg___closed__10;
x_10 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_10, 0, x_8);
lean_ctor_set(x_10, 1, x_9);
x_11 = lean_alloc_ctor(4, 2, 0);
lean_ctor_set(x_11, 0, x_6);
lean_ctor_set(x_11, 1, x_10);
x_12 = 0;
x_13 = lean_alloc_ctor(6, 1, 1);
lean_ctor_set(x_13, 0, x_11);
lean_ctor_set_uint8(x_13, sizeof(void*)*1, x_12);
return x_13;
}
}
}
LEAN_EXPORT lean_object* l_List_format(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; 
x_4 = l_List_format___redArg(x_2, x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_instToFormatList(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_alloc_closure((void*)(l_List_format), 3, 2);
lean_closure_set(x_3, 0, lean_box(0));
lean_closure_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_instToFormatList___redArg(lean_object* x_1) {
_start:
{
lean_object* x_2; 
x_2 = lean_alloc_closure((void*)(l_List_format), 3, 2);
lean_closure_set(x_2, 0, lean_box(0));
lean_closure_set(x_2, 1, x_1);
return x_2;
}
}
static lean_object* _init_l_instToFormatArray___redArg___lam__0___closed__0() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("#", 1, 1);
return x_1;
}
}
static lean_object* _init_l_instToFormatArray___redArg___lam__0___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_instToFormatArray___redArg___lam__0___closed__0;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_instToFormatArray___redArg___lam__0(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; 
x_3 = l_instToFormatArray___redArg___lam__0___closed__1;
x_4 = lean_array_to_list(x_2);
x_5 = l_List_format___redArg(x_1, x_4);
x_6 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_6, 0, x_3);
lean_ctor_set(x_6, 1, x_5);
return x_6;
}
}
LEAN_EXPORT lean_object* l_instToFormatArray___redArg(lean_object* x_1) {
_start:
{
lean_object* x_2; 
x_2 = lean_alloc_closure((void*)(l_instToFormatArray___redArg___lam__0), 2, 1);
lean_closure_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_instToFormatArray(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = l_instToFormatArray___redArg(x_2);
return x_3;
}
}
static lean_object* _init_l_Option_format___redArg___closed__0() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("none", 4, 4);
return x_1;
}
}
static lean_object* _init_l_Option_format___redArg___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_Option_format___redArg___closed__0;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Option_format___redArg___closed__2() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("some ", 5, 5);
return x_1;
}
}
static lean_object* _init_l_Option_format___redArg___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_Option_format___redArg___closed__2;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Option_format___redArg(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3; 
lean_dec_ref(x_1);
x_3 = l_Option_format___redArg___closed__1;
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; 
x_4 = lean_ctor_get(x_2, 0);
lean_inc(x_4);
lean_dec_ref(x_2);
x_5 = l_Option_format___redArg___closed__3;
x_6 = lean_apply_1(x_1, x_4);
x_7 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_7, 0, x_5);
lean_ctor_set(x_7, 1, x_6);
return x_7;
}
}
}
LEAN_EXPORT lean_object* l_Option_format(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; 
x_4 = l_Option_format___redArg(x_2, x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_instToFormatOption(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_alloc_closure((void*)(l_Option_format), 3, 2);
lean_closure_set(x_3, 0, lean_box(0));
lean_closure_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_instToFormatOption___redArg(lean_object* x_1) {
_start:
{
lean_object* x_2; 
x_2 = lean_alloc_closure((void*)(l_Option_format), 3, 2);
lean_closure_set(x_2, 0, lean_box(0));
lean_closure_set(x_2, 1, x_1);
return x_2;
}
}
static lean_object* _init_l_instToFormatProd___redArg___lam__0___closed__0() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked("(", 1, 1);
return x_1;
}
}
static lean_object* _init_l_instToFormatProd___redArg___lam__0___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_instToFormatProd___redArg___lam__0___closed__0;
x_2 = lean_string_length(x_1);
return x_2;
}
}
static lean_object* _init_l_instToFormatProd___redArg___lam__0___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_instToFormatProd___redArg___lam__0___closed__2;
x_2 = l_instNatCastInt___lam__0(x_1);
return x_2;
}
}
static lean_object* _init_l_instToFormatProd___redArg___lam__0___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_instToFormatProd___redArg___lam__0___closed__0;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_instToFormatProd___redArg___lam__0___closed__1() {
_start:
{
lean_object* x_1; 
x_1 = lean_mk_string_unchecked(")", 1, 1);
return x_1;
}
}
static lean_object* _init_l_instToFormatProd___redArg___lam__0___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = l_instToFormatProd___redArg___lam__0___closed__1;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_instToFormatProd___redArg___lam__0(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4; 
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; uint8_t x_19; lean_object* x_20; 
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_3, 1);
x_7 = lean_apply_1(x_1, x_5);
x_8 = l_List_format___redArg___closed__3;
lean_ctor_set_tag(x_3, 5);
lean_ctor_set(x_3, 1, x_8);
lean_ctor_set(x_3, 0, x_7);
x_9 = lean_box(1);
x_10 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_10, 0, x_3);
lean_ctor_set(x_10, 1, x_9);
x_11 = lean_apply_1(x_2, x_6);
x_12 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_12, 0, x_10);
lean_ctor_set(x_12, 1, x_11);
x_13 = l_instToFormatProd___redArg___lam__0___closed__3;
x_14 = l_instToFormatProd___redArg___lam__0___closed__4;
x_15 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_15, 1, x_12);
x_16 = l_instToFormatProd___redArg___lam__0___closed__5;
x_17 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_17, 0, x_15);
lean_ctor_set(x_17, 1, x_16);
x_18 = lean_alloc_ctor(4, 2, 0);
lean_ctor_set(x_18, 0, x_13);
lean_ctor_set(x_18, 1, x_17);
x_19 = 0;
x_20 = lean_alloc_ctor(6, 1, 1);
lean_ctor_set(x_20, 0, x_18);
lean_ctor_set_uint8(x_20, sizeof(void*)*1, x_19);
return x_20;
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; uint8_t x_36; lean_object* x_37; 
x_21 = lean_ctor_get(x_3, 0);
x_22 = lean_ctor_get(x_3, 1);
lean_inc(x_22);
lean_inc(x_21);
lean_dec(x_3);
x_23 = lean_apply_1(x_1, x_21);
x_24 = l_List_format___redArg___closed__3;
x_25 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_25, 0, x_23);
lean_ctor_set(x_25, 1, x_24);
x_26 = lean_box(1);
x_27 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_27, 0, x_25);
lean_ctor_set(x_27, 1, x_26);
x_28 = lean_apply_1(x_2, x_22);
x_29 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_29, 0, x_27);
lean_ctor_set(x_29, 1, x_28);
x_30 = l_instToFormatProd___redArg___lam__0___closed__3;
x_31 = l_instToFormatProd___redArg___lam__0___closed__4;
x_32 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_32, 1, x_29);
x_33 = l_instToFormatProd___redArg___lam__0___closed__5;
x_34 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_34, 0, x_32);
lean_ctor_set(x_34, 1, x_33);
x_35 = lean_alloc_ctor(4, 2, 0);
lean_ctor_set(x_35, 0, x_30);
lean_ctor_set(x_35, 1, x_34);
x_36 = 0;
x_37 = lean_alloc_ctor(6, 1, 1);
lean_ctor_set(x_37, 0, x_35);
lean_ctor_set_uint8(x_37, sizeof(void*)*1, x_36);
return x_37;
}
}
}
LEAN_EXPORT lean_object* l_instToFormatProd___redArg(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; 
x_3 = lean_alloc_closure((void*)(l_instToFormatProd___redArg___lam__0), 3, 2);
lean_closure_set(x_3, 0, x_1);
lean_closure_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_instToFormatProd(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; 
x_5 = l_instToFormatProd___redArg(x_3, x_4);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Std_Iterators_IterM_DefaultConsumers_toArrayMapped_go___at___00String_toFormat_spec__1___redArg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; 
if (lean_obj_tag(x_2) == 0)
{
uint8_t x_9; 
x_9 = !lean_is_exclusive(x_2);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; uint8_t x_16; 
x_10 = lean_ctor_get(x_2, 0);
x_11 = lean_ctor_get(x_2, 1);
x_12 = lean_ctor_get(x_1, 0);
x_13 = lean_ctor_get(x_1, 1);
x_14 = lean_ctor_get(x_1, 2);
x_15 = lean_nat_sub(x_14, x_13);
x_16 = lean_nat_dec_eq(x_11, x_15);
lean_dec(x_15);
if (x_16 == 0)
{
uint32_t x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; uint32_t x_21; uint8_t x_22; 
x_17 = 10;
x_18 = lean_nat_add(x_13, x_11);
x_19 = lean_string_utf8_next_fast(x_12, x_18);
x_20 = lean_nat_sub(x_19, x_13);
lean_dec(x_19);
x_21 = lean_string_utf8_get_fast(x_12, x_18);
lean_dec(x_18);
x_22 = lean_uint32_dec_eq(x_21, x_17);
if (x_22 == 0)
{
lean_dec(x_11);
lean_ctor_set(x_2, 1, x_20);
goto _start;
}
else
{
lean_object* x_24; 
lean_inc_ref(x_1);
x_24 = l_String_Slice_slice_x21(x_1, x_10, x_11);
lean_dec(x_11);
lean_dec(x_10);
lean_inc(x_20);
lean_ctor_set(x_2, 1, x_20);
lean_ctor_set(x_2, 0, x_20);
x_4 = x_2;
x_5 = x_24;
goto block_8;
}
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; 
lean_free_object(x_2);
lean_dec(x_11);
x_25 = lean_nat_add(x_13, x_10);
lean_dec(x_10);
lean_inc(x_14);
lean_inc_ref(x_12);
x_26 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_26, 0, x_12);
lean_ctor_set(x_26, 1, x_25);
lean_ctor_set(x_26, 2, x_14);
x_27 = lean_box(1);
x_4 = x_27;
x_5 = x_26;
goto block_8;
}
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; uint8_t x_34; 
x_28 = lean_ctor_get(x_2, 0);
x_29 = lean_ctor_get(x_2, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_2);
x_30 = lean_ctor_get(x_1, 0);
x_31 = lean_ctor_get(x_1, 1);
x_32 = lean_ctor_get(x_1, 2);
x_33 = lean_nat_sub(x_32, x_31);
x_34 = lean_nat_dec_eq(x_29, x_33);
lean_dec(x_33);
if (x_34 == 0)
{
uint32_t x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; uint32_t x_39; uint8_t x_40; 
x_35 = 10;
x_36 = lean_nat_add(x_31, x_29);
x_37 = lean_string_utf8_next_fast(x_30, x_36);
x_38 = lean_nat_sub(x_37, x_31);
lean_dec(x_37);
x_39 = lean_string_utf8_get_fast(x_30, x_36);
lean_dec(x_36);
x_40 = lean_uint32_dec_eq(x_39, x_35);
if (x_40 == 0)
{
lean_object* x_41; 
lean_dec(x_29);
x_41 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_41, 0, x_28);
lean_ctor_set(x_41, 1, x_38);
x_2 = x_41;
goto _start;
}
else
{
lean_object* x_43; lean_object* x_44; 
lean_inc_ref(x_1);
x_43 = l_String_Slice_slice_x21(x_1, x_28, x_29);
lean_dec(x_29);
lean_dec(x_28);
lean_inc(x_38);
x_44 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_44, 0, x_38);
lean_ctor_set(x_44, 1, x_38);
x_4 = x_44;
x_5 = x_43;
goto block_8;
}
}
else
{
lean_object* x_45; lean_object* x_46; lean_object* x_47; 
lean_dec(x_29);
x_45 = lean_nat_add(x_31, x_28);
lean_dec(x_28);
lean_inc(x_32);
lean_inc_ref(x_30);
x_46 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_46, 0, x_30);
lean_ctor_set(x_46, 1, x_45);
lean_ctor_set(x_46, 2, x_32);
x_47 = lean_box(1);
x_4 = x_47;
x_5 = x_46;
goto block_8;
}
}
}
else
{
lean_dec_ref(x_1);
return x_3;
}
block_8:
{
lean_object* x_6; 
x_6 = lean_array_push(x_3, x_5);
x_2 = x_4;
x_3 = x_6;
goto _start;
}
}
}
LEAN_EXPORT lean_object* l_Std_Iterators_IterM_DefaultConsumers_toArrayMapped_go___at___00String_toFormat_spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; 
x_5 = l_Std_Iterators_IterM_DefaultConsumers_toArrayMapped_go___at___00String_toFormat_spec__1___redArg(x_1, x_3, x_4);
return x_5;
}
}
static lean_object* _init_l_String_Slice_split___at___00String_toFormat_spec__0___closed__0() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = lean_unsigned_to_nat(0u);
x_2 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_2, 0, x_1);
lean_ctor_set(x_2, 1, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_String_Slice_split___at___00String_toFormat_spec__0(lean_object* x_1) {
_start:
{
lean_object* x_2; 
x_2 = l_String_Slice_split___at___00String_toFormat_spec__0___closed__0;
return x_2;
}
}
static lean_object* _init_l_String_toFormat___closed__0() {
_start:
{
lean_object* x_1; lean_object* x_2; 
x_1 = lean_unsigned_to_nat(0u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_List_foldl___at___00Std_Format_joinSep___at___00String_toFormat_spec__2_spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
lean_dec(x_1);
return x_2;
}
else
{
uint8_t x_4; 
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; 
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_3, 1);
x_7 = lean_ctor_get(x_5, 0);
lean_inc_ref(x_7);
x_8 = lean_ctor_get(x_5, 1);
lean_inc(x_8);
x_9 = lean_ctor_get(x_5, 2);
lean_inc(x_9);
lean_dec(x_5);
lean_inc(x_1);
lean_ctor_set_tag(x_3, 5);
lean_ctor_set(x_3, 1, x_1);
lean_ctor_set(x_3, 0, x_2);
x_10 = lean_string_utf8_extract(x_7, x_8, x_9);
lean_dec(x_9);
lean_dec(x_8);
lean_dec_ref(x_7);
x_11 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_11, 0, x_10);
x_12 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_12, 0, x_3);
lean_ctor_set(x_12, 1, x_11);
x_2 = x_12;
x_3 = x_6;
goto _start;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; 
x_14 = lean_ctor_get(x_3, 0);
x_15 = lean_ctor_get(x_3, 1);
lean_inc(x_15);
lean_inc(x_14);
lean_dec(x_3);
x_16 = lean_ctor_get(x_14, 0);
lean_inc_ref(x_16);
x_17 = lean_ctor_get(x_14, 1);
lean_inc(x_17);
x_18 = lean_ctor_get(x_14, 2);
lean_inc(x_18);
lean_dec(x_14);
lean_inc(x_1);
x_19 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_19, 0, x_2);
lean_ctor_set(x_19, 1, x_1);
x_20 = lean_string_utf8_extract(x_16, x_17, x_18);
lean_dec(x_18);
lean_dec(x_17);
lean_dec_ref(x_16);
x_21 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_21, 0, x_20);
x_22 = lean_alloc_ctor(5, 2, 0);
lean_ctor_set(x_22, 0, x_19);
lean_ctor_set(x_22, 1, x_21);
x_2 = x_22;
x_3 = x_15;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Std_Format_joinSep___at___00String_toFormat_spec__2(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_3; 
lean_dec(x_2);
x_3 = lean_box(0);
return x_3;
}
else
{
lean_object* x_4; 
x_4 = lean_ctor_get(x_1, 1);
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
lean_dec(x_2);
x_5 = lean_ctor_get(x_1, 0);
lean_inc(x_5);
lean_dec_ref(x_1);
x_6 = lean_ctor_get(x_5, 0);
lean_inc_ref(x_6);
x_7 = lean_ctor_get(x_5, 1);
lean_inc(x_7);
x_8 = lean_ctor_get(x_5, 2);
lean_inc(x_8);
lean_dec(x_5);
x_9 = lean_string_utf8_extract(x_6, x_7, x_8);
lean_dec(x_8);
lean_dec(x_7);
lean_dec_ref(x_6);
x_10 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_10, 0, x_9);
return x_10;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; 
lean_inc(x_4);
x_11 = lean_ctor_get(x_1, 0);
lean_inc(x_11);
lean_dec_ref(x_1);
x_12 = lean_ctor_get(x_11, 0);
lean_inc_ref(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
x_14 = lean_ctor_get(x_11, 2);
lean_inc(x_14);
lean_dec(x_11);
x_15 = lean_string_utf8_extract(x_12, x_13, x_14);
lean_dec(x_14);
lean_dec(x_13);
lean_dec_ref(x_12);
x_16 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_16, 0, x_15);
x_17 = l_List_foldl___at___00Std_Format_joinSep___at___00String_toFormat_spec__2_spec__2(x_2, x_16, x_4);
return x_17;
}
}
}
}
LEAN_EXPORT lean_object* l_String_toFormat(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; 
x_2 = lean_unsigned_to_nat(0u);
x_3 = lean_string_utf8_byte_size(x_1);
x_4 = lean_alloc_ctor(0, 3, 0);
lean_ctor_set(x_4, 0, x_1);
lean_ctor_set(x_4, 1, x_2);
lean_ctor_set(x_4, 2, x_3);
x_5 = l_String_Slice_split___at___00String_toFormat_spec__0(x_4);
x_6 = l_String_toFormat___closed__0;
x_7 = l_Std_Iterators_IterM_DefaultConsumers_toArrayMapped_go___at___00String_toFormat_spec__1___redArg(x_4, x_5, x_6);
x_8 = lean_array_to_list(x_7);
x_9 = lean_box(1);
x_10 = l_Std_Format_joinSep___at___00String_toFormat_spec__2(x_8, x_9);
return x_10;
}
}
LEAN_EXPORT lean_object* l_String_Slice_split___at___00String_toFormat_spec__0___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2; 
x_2 = l_String_Slice_split___at___00String_toFormat_spec__0(x_1);
lean_dec_ref(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_instToFormatRaw___lam__0(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; 
x_2 = l_Nat_reprFast(x_1);
x_3 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_3, 0, x_2);
return x_3;
}
}
static lean_object* _init_l_instToFormatRaw() {
_start:
{
lean_object* x_1; 
x_1 = lean_alloc_closure((void*)(l_instToFormatRaw___lam__0), 1, 0);
return x_1;
}
}
lean_object* initialize_Init_Data_Array_Basic(uint8_t builtin);
lean_object* initialize_Init_Data_String_Search(uint8_t builtin);
static bool _G_initialized = false;
LEAN_EXPORT lean_object* initialize_Init_Data_Format_Instances(uint8_t builtin) {
lean_object * res;
if (_G_initialized) return lean_io_result_mk_ok(lean_box(0));
_G_initialized = true;
res = initialize_Init_Data_Array_Basic(builtin);
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Data_String_Search(builtin);
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
l_List_format___redArg___closed__0 = _init_l_List_format___redArg___closed__0();
lean_mark_persistent(l_List_format___redArg___closed__0);
l_List_format___redArg___closed__1 = _init_l_List_format___redArg___closed__1();
lean_mark_persistent(l_List_format___redArg___closed__1);
l_List_format___redArg___closed__2 = _init_l_List_format___redArg___closed__2();
lean_mark_persistent(l_List_format___redArg___closed__2);
l_List_format___redArg___closed__3 = _init_l_List_format___redArg___closed__3();
lean_mark_persistent(l_List_format___redArg___closed__3);
l_List_format___redArg___closed__4 = _init_l_List_format___redArg___closed__4();
lean_mark_persistent(l_List_format___redArg___closed__4);
l_List_format___redArg___closed__5 = _init_l_List_format___redArg___closed__5();
lean_mark_persistent(l_List_format___redArg___closed__5);
l_List_format___redArg___closed__7 = _init_l_List_format___redArg___closed__7();
lean_mark_persistent(l_List_format___redArg___closed__7);
l_List_format___redArg___closed__8 = _init_l_List_format___redArg___closed__8();
lean_mark_persistent(l_List_format___redArg___closed__8);
l_List_format___redArg___closed__9 = _init_l_List_format___redArg___closed__9();
lean_mark_persistent(l_List_format___redArg___closed__9);
l_List_format___redArg___closed__6 = _init_l_List_format___redArg___closed__6();
lean_mark_persistent(l_List_format___redArg___closed__6);
l_List_format___redArg___closed__10 = _init_l_List_format___redArg___closed__10();
lean_mark_persistent(l_List_format___redArg___closed__10);
l_instToFormatArray___redArg___lam__0___closed__0 = _init_l_instToFormatArray___redArg___lam__0___closed__0();
lean_mark_persistent(l_instToFormatArray___redArg___lam__0___closed__0);
l_instToFormatArray___redArg___lam__0___closed__1 = _init_l_instToFormatArray___redArg___lam__0___closed__1();
lean_mark_persistent(l_instToFormatArray___redArg___lam__0___closed__1);
l_Option_format___redArg___closed__0 = _init_l_Option_format___redArg___closed__0();
lean_mark_persistent(l_Option_format___redArg___closed__0);
l_Option_format___redArg___closed__1 = _init_l_Option_format___redArg___closed__1();
lean_mark_persistent(l_Option_format___redArg___closed__1);
l_Option_format___redArg___closed__2 = _init_l_Option_format___redArg___closed__2();
lean_mark_persistent(l_Option_format___redArg___closed__2);
l_Option_format___redArg___closed__3 = _init_l_Option_format___redArg___closed__3();
lean_mark_persistent(l_Option_format___redArg___closed__3);
l_instToFormatProd___redArg___lam__0___closed__0 = _init_l_instToFormatProd___redArg___lam__0___closed__0();
lean_mark_persistent(l_instToFormatProd___redArg___lam__0___closed__0);
l_instToFormatProd___redArg___lam__0___closed__2 = _init_l_instToFormatProd___redArg___lam__0___closed__2();
lean_mark_persistent(l_instToFormatProd___redArg___lam__0___closed__2);
l_instToFormatProd___redArg___lam__0___closed__3 = _init_l_instToFormatProd___redArg___lam__0___closed__3();
lean_mark_persistent(l_instToFormatProd___redArg___lam__0___closed__3);
l_instToFormatProd___redArg___lam__0___closed__4 = _init_l_instToFormatProd___redArg___lam__0___closed__4();
lean_mark_persistent(l_instToFormatProd___redArg___lam__0___closed__4);
l_instToFormatProd___redArg___lam__0___closed__1 = _init_l_instToFormatProd___redArg___lam__0___closed__1();
lean_mark_persistent(l_instToFormatProd___redArg___lam__0___closed__1);
l_instToFormatProd___redArg___lam__0___closed__5 = _init_l_instToFormatProd___redArg___lam__0___closed__5();
lean_mark_persistent(l_instToFormatProd___redArg___lam__0___closed__5);
l_String_Slice_split___at___00String_toFormat_spec__0___closed__0 = _init_l_String_Slice_split___at___00String_toFormat_spec__0___closed__0();
lean_mark_persistent(l_String_Slice_split___at___00String_toFormat_spec__0___closed__0);
l_String_toFormat___closed__0 = _init_l_String_toFormat___closed__0();
lean_mark_persistent(l_String_toFormat___closed__0);
l_instToFormatRaw = _init_l_instToFormatRaw();
lean_mark_persistent(l_instToFormatRaw);
return lean_io_result_mk_ok(lean_box(0));
}
#ifdef __cplusplus
}
#endif
